import type {Directive} from "vue";
import {userStore} from "@/store/user";


export default function hasParm(value:any){
    const store = userStore()
    //当前用户拥有的权限字段
    const permission = store.getCodeLIst
    if(value && value instanceof Array && value.length>0){
        //按钮权限需要的字段
        const permissionRoles = value
        const hasPermission = permission.some((role)=>{
            return permissionRoles.includes(role)
        })
        return hasPermission
    }else{
        throw new Error('v-if ="global.$hasPerm("')
    }
}